<div ng-controller="FapiaoDetailCtrl as vm">
  <h1 class="page-title">发票详情</h1>
  <div class="btn-toolbar">
    <button ng-show="vm.pickable" class="btn btn-primary" ng-click="vm.writeBack()"><i class="icon-ok"></i> 发票反写</button>
    <div class="btn-group">
        <button ng-show="vm.userRole=='admin' && vm.fapiao.status>0" class="btn btn-primary" ng-click="vm.revert()">状态回退</button>
    </div>
  </div>
  <div class="well">
    <form class="form-horizontal">
      <fieldset>
        
        
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">发票申请号</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.applicationId" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">申请人企业</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.shipper.enterpriseName" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">发货人纳税识别号</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.shipper.taxerId" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">承运方</label>
          <div class="controls">
              <input ng-show="vm.fapiao.carrier" type="text" ng-model="vm.fapiao.carrier.contact.name" class="input-xlarge" readonly>
            <input ng-show="vm.fapiao.serviceShipper" type="text" ng-model="vm.fapiao.serviceShipper.enterpriseName" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">承运方身份证／纳税识别号</label>
          <div class="controls">
            <input ng-show="vm.fapiao.carrier" type="text" ng-model="vm.fapiao.carrier.idCardNumber" class="input-xlarge" readonly>
              <input ng-show="vm.fapiao.serviceShipper" type="text" ng-model="vm.fapiao.serviceShipper.taxerId" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">收货人</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.receiver" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">收货人纳税识别号</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.receiverTaxerId" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">车牌号</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.vehicleObj" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">总金额</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.price" class="input-xlarge" readonly>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">运单数</label>
          <div class="controls">
            <input type="text" ng-model="vm.fapiao.orderCount" class="input-xlarge" readonly>
          </div>
        </div>
      </fieldset>
    </form>
    <div class="table-responsive">
      <table class="table table-striped table-bordered">
        <thead>
          <tr>
            <th>运单号</th>
            <th>运费金额</th>
            <th>支付状态</th>
            <th>线路</th>
            <th>司机</th>
            <th>车辆</th>
            <th>操作</th>
            
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="order in vm.fapiao.orders">
            <input hidden ng-model="orderId" value="order.id">
            <td>{{order.orderId}}</td>
            <td>{{order.price}}</td>
            <td>{{order.paid? '已付款':'未付款'}}</td>
            <td>{{order.route}}</td>
            <td>{{order.driver.name}}</td>
            <td>{{order.vehicle.vehicleNumber}}</td>
            <td><a ng-show="order.status>3" id="map_{{order.orderId}}_{{order.vehicle.id}}" onclick='openWindow(this.id)'  class="btn btn-mini btn-info">查看地图</a></td>
          </tr>
          
        </tbody>
      </table>
    </div>
    <div class="pagination pagination-centered" ng-show="!vm.noRecord">
        <ul>
         <li ng-class="vm.firstPage? 'disabled':''" ng-switch="vm.firstPage">
         <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage-1)" >&laquo;</a>
         <a ng-switch-when="true" >&laquo;</a>
         </li>
          <li ng-repeat="me in vm.pages" ng-class="me==vm.currentPage? 'active':''" ng-switch="me==vm.currentPage">
            <a ng-switch-when="false" ng-click="vm.loadPage(me)" >{{me}}</a>
            <a ng-switch-when="true" >{{me}}</a>
            </li>
          <li ng-class="vm.lastPage? 'disabled':''" ng-switch on="vm.lastPage">
          <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage+1)">&raquo;</a>
          <a ng-switch-when="true" >&raquo;</a>
          </li>
        </ul>
      </div>
    <a ng-click="vm.selectOrder(vm.fapiao.id, '')" class="btn btn-default" ng-show="false">添加同类型运单</a>
  </div>
</div>
 <script>
    function openWindow(oid)
    {
        oid = oid.replace("map_","");
        var ids = oid.split("_");
        var orderId = ids[0];
        var vehicleId = ids[1];
        var url = "../views/map/map.html?id="+ orderId + "&vid="+vehicleId;
        var child = window.open(url ,"运单路线","width=800,height=600,toolbar=no,scrollbars=no,menubar=no,screenX=100,screenY=50");
    }
</script>